package com.example.invoke.listener;

import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;

public class CommonEvent extends ApplicationEvent {

    @Setter
    @Getter
    private String name;

    public CommonEvent(Object source, String name) {
        super(source);
        this.name = name;
    }

    public CommonEvent(Object source) {
        super(source);
    }

    public static CommonEvent getInstance(Object source, String name) {
        return new CommonEvent(source, name);
    }

    @Override
    public String toString() {
        return "CommonEvent{" +
                "name='" + name + '\'' +
                ", source=" + source +
                '}';
    }
}
